package com.oig.sys.log.entity;

import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import java.io.Serializable;


/**
 * @author wuxl
 * 审计日志
 */
@Data
@Document(indexName = "sys_audit_log")
public class TbSysAuditLog implements Serializable {

	/**
	 */
	@Id
	private String id;

	/**
	 * 追踪id
	 */
	@Field(type = FieldType.Text)
	private String traceId;

	/**
	 * 变动表
	 */
	@Field(type = FieldType.Text)
	private String tableName;

	/**
	 * 表记录id
	 */
	@Field(type = FieldType.Text)
	private String tableId;

	/**
	 * 操作
	 */
	@Field(type = FieldType.Text)
	private String operation;

	/**
	 * 修改之后的值
	 */
	@Field(type = FieldType.Text)
	private String newValue;

	/**
	 * 修改之前的值
	 */
	@Field(type = FieldType.Text)
	private String oldValue;

	/**
	 * 创建时间
	 */
	@CreatedDate
	@Temporal(TemporalType.TIMESTAMP)
	@Field(type = FieldType.Date)
	private java.util.Date createTime;

	/**
	 */
	@Field(type = FieldType.Integer)
	private Integer userId;

	/**
	 */
	@Field(type = FieldType.Text)
	private String userName;

	/**
	 * 日志也做租户隔离
	 */
	@Field(type = FieldType.Integer)
	private Integer tenantId;

	/**
	 * 数据所属机构
	 */
	@Field(type = FieldType.Text)
	private String tenantName;
}
